package Collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedList;

public class CollectionDemo1 {
    public static void main(String[] args) {
        Collection c = new ArrayList();
//        Collection c = new HashSet();//不可重复
//        c.add("one");
        System.out.println(c.add("one"));
        c.add("two");
        c.add("three");
        c.add("four");
        c.add("five");
//        c.add("one");

        System.out.println(c.add("one"));//Set集合不能存放重复元素,返回值为false
        c.clear();//清空集合
        System.out.println(c);
        /*
            返回当前集合元素的个数
         */
        int size = c.size();
        System.out.println("size:"+size);
        /*
            boolean isEmpty()
         */
        boolean boo = c.isEmpty();
        System.out.println(boo);

    }
}
